﻿#ifndef CDevDataSensorSeries_H
#define CDevDataSensorSeries_H
/********************************************************************************
** @ Date:2025/08/08
** @ Author: HanJiaXin
** @ Description:声振温设备数据类
** @ Version:1.0.0
** @ ClassName:CDevDataSensorSeries
** @ Fun:
********************************************************************************/
#include <QObject>
#include "Header.h"
#include "CMeasurePoint.h"

struct SChannel
{
	int nChannelNo;//通道号
	QString sChannelName;//通道名称
	int nIsEnable;//是否启用
	bool nState;//在线状态
	bool nStateValue;//在线状态测点
	bool bTempState;//温度是否报警
	bool bVoiceState;//声音是否报警
	bool bVibrationState;//振动是否报警
	QDateTime m_dTemp;
	QDateTime m_dVoice;
	QDateTime m_dVicration;
	QString sSerialNumber;
	SChannel()
	{
		nChannelNo = 0;
		sChannelName = "";
		nState = 0;
		nIsEnable = 0;
		sSerialNumber = "";
		nStateValue = 1;
		bTempState = true;
		bVoiceState = true;
		bVibrationState = true;
		m_dTemp = QDateTime::currentDateTime();
		m_dVoice = QDateTime::currentDateTime();
		m_dVicration = QDateTime::currentDateTime();
	};
};

struct SSensorSeriesAlarmInfo
{
	QString sGuid;//报警记录Guid
	QString sSceneGuid;//场景Guid
	QString sDevGuid;//设备Guid
	QString sDevName;//报警设备名
	int nChannel;//通道号
	QString sChannelName;//通道名称
	QString sAlarmTime;//报警时间
	QString sAccDirect;//维度
	int nTempAlarm;
	int nVibrationAlarm;
	int nVoiceAlarm;
	double dTempValue;//温度
	double dRMS;//加速度
	double dTimePeakToPeak;//时域峰峰值
	double dEnvPeakToPeak;//(包络谱)峰峰值
	double dEnvFaultFrqMulti;//(包络谱)故障频率的倍频
	double dEnvBladePassFrqMulti;//(包络谱)转频的倍频
	double dBladePassEdgeFrqMultiSum;//转频的边频倍频个数之和
	double dTimeDomainKurtosis;//时域峭度
	double dShapeFactor;//形状因子
	QString sBeltName;//皮带名称
};


class CDevDataSensorSeries  : public QObject
{
	Q_OBJECT

public:
	CDevDataSensorSeries(QObject *parent = nullptr);
	~CDevDataSensorSeries();

	void resetData();//重置设备数据

signals:
	void sigResult(int nRequestType, QString sResult);
	void sigCfgChanged();

public:
	QMutex *m_pMutex;
	QString m_sDevGuid;     //设备GUID
	QString m_sDevName;     //设备名称
	QString m_sBeltName;	//归属皮带

	QString m_sIp;						//ip地址
	QString m_sUserName;				//用户名
	QString m_sPassWd;					//密码
	bool m_nState;						//在线状态
	bool m_nStateValue;					//在线状态测点值
	QMap<int, SChannel> m_mapChannel;		//通道组
	QMap<EDevPointType, CMeasurePoint*> m_mapDevPoint;//测点集合
	QMap<QString, QString> m_mapInputPointAddr;//key:输入测点唯一标识，value输入测点地址
	QMap<QString, CMeasurePoint*> m_mapInputPoint;
};

#endif